$(function () {
    $(".panel-toggle").on(
        "click", function () {
            var upReg = new RegExp("glyphicon-chevron-up");
            var downReg = new RegExp("glyphicon-chevron-down");
            var classes = $(this).attr('class');
            if (upReg.test(classes)) {
                $(this).removeClass("glyphicon-chevron-up");
                $(this).addClass("glyphicon-chevron-down");
                $(this).parent().parent().next().slideDown();
            } else if (downReg.test(classes)) {
                $(this).removeClass("glyphicon-chevron-down");
                $(this).addClass("glyphicon-chevron-up");
                $(this).parent().parent().next().slideUp();
            }
        }
    );
});